<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <!-- basic styles -->
        <link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="../assets/css/font-awesome.min.css" />
        <link rel="stylesheet" href="../assets/css/ace.min.css" />
        <link rel="stylesheet" href="../assets/css/ace-rtl.min.css" />
        <link rel="stylesheet" href="../assets/css/ace-skins.min.css" />
    </head>
    <body>
        <div class="main-container">
            <div class="col-xs-12">
                <h3 class="header smaller lighter blue">策略管理</h3>
                <div style="float: right;margin-top: -44px;">
                    <button class="btn btn-success btn-xs" onclick="addPolicy()">添加策略</button>
                    <button class="btn btn-danger btn-xs" onclick="previous()">返回上一层</button>
                </div>
                <div class="table-header">
                    策略设置
                </div>
                <div class="table-responsive">
                    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr>
                                <th>策略名称</th>
                                <th>MessageNO</th>
                                <th>版本号</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">选择设备</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal">
                            <div class=" row box">
<!--                                <div class="checkbox col-xs-4">
                                    <label>
                                        <input type="checkbox" class="ace" checked name="form-field-checkbox">
                                        <span class="lbl"> choice 1</span>
                                    </label>
                                </div>-->
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <a href="javascript:void(0)" class="btn btn-default" data-dismiss="modal">取消</a>
                        <a href="javascript:void(0)" class="btn btn-primary addIssuedList">确定</a>
                    </div>
                </div>
            </div>
        </div>
        <script src="../assets/js/jquery.js"></script>
        <script src="../assets/js/bootstrap.min.js"></script>
        <!-- page specific plugin scripts -->
        <script src="../assets/js/jquery-ui-1.10.3.custom.min.js"></script>
        <script src="../assets/js/jquery.dataTables.min.js"></script>
        <script src="../assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="../assets/js/logic/policy.js"></script>
        <script src="../assets/js/Base64.js"></script>
        <script type="text/javascript">
                        var base64 = new Base64();
                        var type = getQueryString("type");
                        var DepotID = getQueryString("id");
                        var DepotName = decodeURIComponent(getQueryString("name"));
                        DepotName = base64.decode(DepotName);
                        //console.log("type:" + type + "\tDepotID:" + DepotID + "\tDepotName:" + DepotName)
                        jQuery(function ($) {
                            $(".header").text(DepotName + "  策略管理");
                            var souData = getPolicyAll();
                            var aaData = [];
                            for (var i in souData) {
                                var Description = souData[i].Description;
                                var MessageNo = souData[i].MessageNo;
                                var Version = souData[i].Version;
                                var oper = '';
                                if (type == "0x40") {
                                    // 用户组管理
                                    oper += "<a class='blue' href='0x40/policy.html?DepotID=" + DepotID + "&DepotName=" + base64.encode(DepotName) + "&type=" + type + "&id=" + MessageNo+"' title='查看该策略'>";
                                    oper += "    <i class='icon-th bigger-130'></i>";
                                    oper += "</a>";
                                    oper += "<a class='green' href='javascript:void(0)' title='添加到下发队列' onclick='deviceListBox(" + MessageNo + ")'>";
                                    oper += "    <i class='icon-plus bigger-130'></i>";
                                    oper += "</a>";
                                }else{
                                    // 策略管理
                                    oper += "<a class='blue' href='javascript:void(0)' title='查看该策略历史版本' onclick='show_oldPolicy(" + MessageNo + ")'>";
                                    oper += "    <i class='icon-search bigger-130'></i>";
                                    oper += "</a>";
                                    oper += "<a class='blue' href='javascript:void(0)' title='编辑该策略' onclick='editPolicy(" + MessageNo + ")'>";
                                    oper += "    <i class='icon-pencil bigger-130'></i>";
                                    oper += "</a>";
                                    oper += "<a class='red' href='javascript:void(0)' title='删除该策略' onclick='delPolicy(" + MessageNo + ")'>";
                                    oper += "    <i class='icon-trash bigger-130'></i>";
                                    oper += "</a>";
                                    oper += "<a class='green' href='javascript:void(0)' title='添加到下发队列' onclick='deviceListBox(" + MessageNo + ")'>";
                                    oper += "    <i class='icon-plus bigger-130'></i>";
                                    oper += "</a>";
                                }
                                
                                aaData.push([Description, MessageNo, Version, oper]);
                            }
                            var oTable1 = $('#sample-table-2').dataTable({
                                "aoColumns": [
                                    {"bSortable": false},
                                    {"bSortable": false},
                                    {"bSortable": false},
                                    {"bSortable": false}
                                ],
                                "aaData": aaData
                            });
                            setInterval(function () {
                                parent.$("#page-content").attr("height", $("html").height());
                            }, 500);
                        })
        </script>
    </body>
</html>
